package internet_11;

import java.io.*;
import java.net.Socket;

/*
    客户端：数据来自于文本文件，接收服务器反馈
 */
public class Client {
    public static void main(String[] args) throws IOException {
        Socket s=new Socket("127.0.0.1",10001);
        BufferedReader br=new BufferedReader(new FileReader("day12_internet\\s.txt"));

        BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));

        String line;
        while ((line=br.readLine())!=null){
            bw.write(line);
            bw.newLine();
            bw.flush();
        }
        s.shutdownOutput();
        //接收反馈
        BufferedReader brr=new BufferedReader(new InputStreamReader(s.getInputStream()));
        String date = brr.readLine();
        System.out.println("服务器反馈:"+date);

        s.close();
        br.close();

        /*BufferedWriter br=new BufferedWriter(new FileWriter("day12_internet\\ss.txt"));
        br.write("往后余生");
        br.close();*/
    }
}
